import React from "react";
import {Link} from 'react-router-dom';
import './header.scss';
export class HeaderComponent extends React.Component {

    constructor(props){
        super(props);

        this.state = {
            count : 0
        }

    }

    goLogin(){
        this.state.count++;
        if(this.state.count === 7){
            console.log(this.props.history)
            this.props.history.push('/login');
            this.state.count = 0;
        }
    }

    render(){

        return <header>
            <h1>飞哥工作室</h1>
            <span onClick={this.goLogin.bind(this)}>
                <svg className="icon" aria-hidden="true">
                    <use xlinkHref="#icon-xiaoqiche" />
                </svg>
            </span>
            <Link to="/help">
                <svg className="icon" aria-hidden="true">
                    <use xlinkHref="#icon-dianhua" />
                </svg>
            </Link>
        </header>

    }

}